﻿using System;
using System.Net;

namespace UdpAsyncEcho
{
    static class Program
    {
        static void Main(string[] args)
        {
            IPEndPoint svrEndpoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 7027);

            if (args[0].Equals("server", StringComparison.OrdinalIgnoreCase))
            {
                using (Server server = new Server(svrEndpoint.Port))
                {
                    server.StartReceive();
                    Console.ReadLine();
                }//using
            }
            else if (args[0].Equals("client", StringComparison.OrdinalIgnoreCase))
            {
                IContentProvider provider = new BatchContentProvider(args[1], 9);
                using (Client client = new Client(svrEndpoint, provider))
                {
                    client.StartSend();
                    Console.ReadLine();
                }//using
            }
            else
                throw new ArgumentOutOfRangeException("unknown startup option.");
        }// Main
    }
}
